package com.lind.kickoffki.android;

import android.graphics.RectF;

import com.lind.kickoff.logic.IPoint;
import com.lind.kickoff.logic.IRectangle;

public class AndroidRectangle implements IRectangle {

	RectF rect;

	public AndroidRectangle(int x, int y, int b, int h) {
		rect = new RectF(x, y, b, h);
	}

	@Override
	public void setX(int x) {
		rect.set(x, rect.top, rect.right, rect.bottom);
	}

	@Override
	public void setY(int y) {
		rect.set(rect.left, y, rect.right, rect.bottom);;
	}

	@Override
	public int getHeight() {
		return (int)rect.height();
	}

	@Override
	public int getWidth() {
		return (int)rect.width();
	}

	@Override
	public int getX() {
		return (int)rect.left;
	}

	@Override
	public int getY() {
		return (int)rect.top;
	}

	@Override
	public void setWidth(int w) {
		rect.set(rect.left, rect.top, rect.left+w, rect.bottom);
	}

	@Override
	public void setHeight(int h) {
		rect.set(rect.left, rect.top, rect.left, rect.top+h);
	}

	public boolean contains(IPoint p) {
		return rect.contains(p.getX(), p.getY());
	}

}
